﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Domain;

namespace Clannan.Models.JsonModel
{
    public class MobileImageJsonModel
    {
        private int id;

        public int ID
        {
            get { return id; }
            set { id = value; }
        }

        private string content;

        public string Content
        {
            get { return content; }
            set { content = value; }
        }
        private DateTime createtime;

        public DateTime CreateTime
        {
            get { return createtime; }
            set { createtime = value; }
        }

        private int imageid;

        public int ImageID
        {
            get { return imageid; }
            set { imageid = value; }
        }

        private Guid imagename;

        public Guid ImageName
        {
            get { return imagename; }
            set { imagename = value; }
        }

        private string imagepath;

        public string ImagePath
        {
            get { return imagepath; }
            set { imagepath = value; }
        }

        /// <summary>
        /// 将对象复制给JsonModel类，防止序列化时会出现重复引用
        /// </summary>
        public MobileImageJsonModel Copy(MobileImageJsonModel mobileimageJsonModel, MobileImage mobileimage)
        {
            mobileimageJsonModel.ID = mobileimage.ID;
            mobileimageJsonModel.Content = mobileimage.Content;
            mobileimageJsonModel.CreateTime = mobileimage.CreateTime;
            mobileimageJsonModel.ImageID = mobileimage.Image.ID;
            mobileimageJsonModel.ImageName = mobileimage.Image.Name;
            mobileimageJsonModel.ImagePath = mobileimage.Image.Path;
            return mobileimageJsonModel;
        }
    }
}